package kafka_model

import java.sql.{Connection, DriverManager}

object DBUtil {

  val username = "lagou2"
  val password = "root"
  val url = "jdbc:mysql://123.57.174.198:3306/lagou2?useUnicode=true&characterEncoding=utf-8&useSSL=false"

  classOf[com.mysql.jdbc.Driver]
  def getConnect() : Connection = {
    DriverManager.getConnection(url,username,password)
  }
  def closeConnect(conn: Connection): Unit = {
    try {
      if (conn != null || !conn.isClosed) {
        conn.close()
      }
    } catch {
      case  ex: Exception => {
        ex.printStackTrace()
      }
    }
  }
}
